<?php
/**
 * Created by PhpStorm.
 * User: 王飞
 * Date: 2017/9/3
 * Time: 14:28
 */
namespace app\admin\controller\staff;

use app\admin\model\StaffCard;
use app\common\controller\Backend;
use app\common\model\Category as CategoryModel;

/**
 * Class Weekrecommend
 * @package app\admin\controller\staff
 * 周推荐
 */
class Weekrecommend extends Backend
{
	protected $model = null;
	
	public function _initialize()
	{
		parent::_initialize();
		$this->model = model('Staff');
	}
	public function index()
	{
		/**
		 * 此页面为员工管理页面的通用页面，以后可以根据用户的相应操作来重新初始化页面并修改相应的信息。
		 * 加载页面需要的数据资源，并加载到页面中
		 */
		if ($this->request->isAjax()) {
			list($where, $sort, $order, $offset, $limit) = $this->buildparams(NULL);
			$total = $this->model
				->where($where)
				->order($sort, $order)
				->count();
			$list = $this->model->with('stafftype')
				->where($where)
				->order($sort, $order)
				->limit($offset, $limit)
				->select();
			$result = array("total" => $total, "rows" => $list);
			
			return json($result);
		}
		return $this->view->fetch();
	}
}